package com.yidu.logisticssystem;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * <p>@Description: 自动生成文档文件</p>
 * <p>@author 小李/p>
 * <p>@Date: 2021/3/4</p>
 * <p>@Time: 14:29</p>
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {
    @Bean
    public  Docket createRestAqi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yidu.logisticssystem.controller"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(getApiInfo());

    }
    private ApiInfo getApiInfo(){
        ApiInfo info=new ApiInfoBuilder()
                .title("物流系统说名书")
                .description("")
                .termsOfServiceUrl("http://localhost:8080")
                .contact(new Contact("","",""))
                .version("6666")
                .build();

        return info;
    }
}
